<template>
  <div>
    <div class="timeline">
      <a-timeline>
        <a-timeline-item v-for="item in timelineArr" :key="item.id">
          <div class="l-item">
            <div>
              <div class="time">{{ moment(item.gmtCreate).format("YYYY-MM-DD") }}</div>
              <div class="content">
                {{ item.distributionInfo }}
                <div class="content-y" v-if="item.distributionReason">
                  <span>原因：{{ item.distributionReason }}</span>
                </div>
              </div>
              <!-- <div class="time">{{ moment(item.gmtCreate).format("YYYY-MM-DD") }}</div>
              <div class="content">
                {{ item.record }}
              </div> -->
            </div>
          </div>
        </a-timeline-item>
      </a-timeline>
    </div>
  </div>
</template>

<script>
import { getCrmCustomerDistributionRecords } from "../api";
export default {
  components: {},
  data() {
    return {
      timelineArr: [{ v: 1 }, { v: 1 }]
    };
  },
  created() {
    this.onGetCrmCustomerDistributionRecords();
  },
  methods: {
    async onGetCrmCustomerDistributionRecords() {
      try {
        const { data } = await getCrmCustomerDistributionRecords({
          customerId: this.$route.query.id,
          "orders[0].property": "gmtCreate",
          "orders[0].desc": true
        });
        this.timelineArr = data;
      } catch (err) {
        console.log("error log --> ", err);
      }
    }
  }
};
</script>

<style lang="scss" scoped>
.timeline {
  width: 500px;
  margin: 40px auto;
  .l-item {
    min-height: 70px;
    padding: 16px 30px 16px 24px;
    background: #f4f6fa;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    box-sizing: border-box;
    .time {
      color: #a6a8b4;
      margin-bottom: 12px;
    }
    .content {
      font-size: 14px;
      .content-y {
        margin-top: 12px;
        color: #767885;
      }
    }
    .btn {
      line-height: 56px;
    }
  }
}
</style>
